//
//  HomeTableViewCell.swift
//  SwfitDemo
//
//  Created by menchao on 2018/9/25.
//  Copyright © 2018年 Test. All rights reserved.
//

import UIKit

class HomeTableViewCell: UITableViewCell {

    var titleLabel: UILabel?
    var detailsImageView: UIImageView?
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
    }
    
    required init?(coder aDecoder:NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.setUpUI()
    }
    
   
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    func updateCellData(model:HomeModel){
        self.titleLabel?.text = model.title;
    }
    
    
    
    func setUpUI() {
        self.titleLabel = UILabel()
        self.titleLabel?.backgroundColor = UIColor.clear;
        self.titleLabel?.frame = CGRect(x:0, y:0, width:300, height:30)
        self.titleLabel?.text = "Title"
        self.titleLabel?.textColor = UIColor.black
        self.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        self.titleLabel?.textAlignment = NSTextAlignment.left
        self.addSubview(self.titleLabel!)
        
        self.detailsImageView = UIImageView()
        self.detailsImageView?.frame = CGRect(x:210, y:0, width:50, height:50)
        self.detailsImageView?.image = UIImage(named: "TestImage")
        self.addSubview(self.detailsImageView!)
    }

}
